package com.liner;

import java.util.ArrayList;
import java.util.Scanner;

/**
 * 汽车类的测试类
 */
public class CarTest {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) {

        /*
         *  创建至少4个对象  并测试
         */

        ArrayList<Car> cars = new ArrayList<>();
        System.out.print("请输入要录入的车辆个数:");
        int num = scanner.nextInt();
        for (int i = 1; i <= num; i++) {
            System.out.println("————请输入第" + i + "辆车的信息介绍————");
            System.out.print("请输入汽车的品牌:");
            String brand = scanner.next();
            System.out.print("请输入汽车的漆色:");
            String color = scanner.next();
            System.out.print("请输入汽车的价格:");
            double price = scanner.nextDouble();
            Car car = new Car(brand, color, price);
            cars.add(car);
        }

        for (Car car : cars) {
            car.information();
            car.start();
            car.run();
            car.stop();
        }

    }

}
